package com.itheima.blockingqueue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/*
阻塞队列的使用
 */
public class Demo02 {

    public static void main(String[] args) throws InterruptedException {
        LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<String>();
        //放
        queue.put("kunkun1");
        queue.put("kunkun2");

        queue.put("kunkun3");
        queue.put("kunkun4");//当 阻塞了队列 满了时 再往进放数据   阻塞了 等着
        //取
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
       // System.out.println(queue.take());
        queue.add("adfgdf");



    }

}
